home *** CD-ROM | disk | FTP | other *** search
- // LENS EFFECTS: CUSTOM EFFECT FILE
- // ********************************
- // This file illustrates how you can use create custom effect files
- // using any of POVRay's texturing features. Use this file as a
- // guide to creating your own custom effect files.
- //
- // STEP 1: Creating the lens effect object
- // ***************************************
- // The features of the lens effects are created using discs textured
- // with semi-transparent pigments. These discs are then rotated and
- // translated into the correct position, determined by the various
- // camera options and the effect_location option. The first step is
- // to create the basic, unpigmented disc, which you do by invoking
- // the _LE_baseobj object:
-
- object {_LE_baseobj
-
- // STEP 2: Texturing the lens effect object
- // ****************************************
- // The next step is to add the desired pigment to the disc. Although
- // any pigment can be used, it is generally best to use some variation
- // of the onion pattern. To make the custom effect file as flexible as
- // possible you want it to properly respond to the effect_colour,
- // source_colour, effect_brightness, and effect_intensity options.
- // To do this, you should specify colours using either the source_colour
- // (NOT source_color) variable, or the _LE_colour variable if you want
- // it be coloured with the effect_colour. You can also use multiples
- // of these variables. You should then add the following to the pigment:
- //
- // transmit pow(.5, _LE_intensity)
- //
- // changing the .5 to reflect the desired intensity. If you want a section
- // of the pigment to be completely transparent you can just use:
- //
- // transmit 1
- //
- // but if you want to make sections of the pigment opaque, do NOT use
- // transmit 0. Instead, use a small number in the pow() statement, eg:
- //
- // transmit pow(.1, _LE_intensity)
- //
- // In the following example we use an onion pigment, which starts with
- // a turbulent bozo pattern in the centre and fades to a transparent
- // effect_colour (note the colours and the transmit values used):
-
- pigment {onion pigment_map {
- [.4 bozo color_map {
- [0 rgb 1.1 * source_colour transmit pow(.5, _LE_intensity)]
- [.8 rgb _LE_colour transmit 1]}
- scale .15 turbulence 2 octaves 3]
- [1 rgb _LE_colour transmit 1]}
- scallop_wave scale 2}
-
- // STEP 3: Positioning the lens effect object
- // ******************************************
- // The final step is to correctly size and position the disc. First you
- // must scale it by a factor of _LE_scale, and then you should rotate it
- // by _LE_rotate around the z axis (the .3 means the disc takes up approx.
- // 30% of the image):
-
- scale .3 * _LE_scale
- rotate z * _LE_rotate
-
- // Then you MUST add the following line to correctly position and layer
- // the disc (DO NOT ALTER THIS LINE):
-
- translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep
- }
-
- // If you use multiple discs you MUST add the above line to EVERY disc
- // you use, unless you are sure the discs don't overlap (in which case
- // you can union the discs together, and add the above line to the union).
- //
- // For more examples of custom effect files, see the Fireball.lfx and
- // Spiral.lfx files. To see how you can combine these files with existing
- // lens effects components, see the CustLFX.pov scene. If you want to
- // create modified versions of existing lens effects components, you should
- // copy the relevant code from LnsEfcts.inc (although keep in mind
- // all the information above regarding colours, transmit values, scaling,
- // rotating, and positioning).
-